package com.example.netty.inoutbound.review;

import com.example.netty.inoutbound.MyBateToLongDecoder2;
import com.example.netty.inoutbound.MyByteToLongDecoder;
import com.example.netty.inoutbound.MyLongToByteEncoder;
import com.example.netty.inoutbound.MyServerHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyServerInitilalizer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline()
                .addLast(new MyByteToLongDecoder())
                .addLast(new MyLongToByteEncoder())
                // 自定义的 handler 处理业务逻辑
                .addLast(new MyServerHandler());
    }
}
